#include "StdAfx.h"
#include "ServerShipsArrivedMessage.h"
#include "ShipsArrivedInfo.h"

ServerShipsArrivedMessage::ServerShipsArrivedMessage(GalconRoom& room, ShipsArrivedInfoPtr shipsArrivedInfoPtr)
   : m_shipsArrivedInfoPtr(shipsArrivedInfoPtr)
   , m_galconRoom(room)
{
}


ServerShipsArrivedMessage::~ServerShipsArrivedMessage(void)
{
}

void ServerShipsArrivedMessage::do_execute()
{
   GameStateAccessorPtr m_gameStateAccessor = m_galconRoom.GetGameStateAccessor();
   m_gameStateAccessor->SetPlanetOwnerID(m_shipsArrivedInfoPtr->DstPlanetID(),
      m_shipsArrivedInfoPtr->GetPlayerID());
   m_gameStateAccessor->SetShipCount(m_shipsArrivedInfoPtr->DstPlanetID(), 
      m_shipsArrivedInfoPtr->CountOfShips());
   m_galconRoom.Deliver(*m_gameStateAccessor->GetGameStateMsg());
}